<?

class BeeRssItem{

	var $title  ;
	var $link     ;
	var $description   ;
	var $author      ;
	var $catagory   ;
	var $comments  ;
	var $enclosure    ;
	var $guid      ;
	var $pubDate  ;	
	
	public static function getEditArray(){
		return  array("title","link","description","author","catagory","comments"
			,"enclosure","enclosure"
		);
		
		
	}
	
}


class BeeRssParser{
	
	
	public function parserSimpleDom($html){
		
		if(!$html) return false;
		$dom=str_get_dom($html);
		$rss=array();
		$rss["title"]=$dom->find("channel title",0)->innertext;
		$rss["link"]=$dom->find("channel link",0)->innertext;
		$rss["description"]=$dom->find("channel description",0)->innertext;
		
		$items=array();
		foreach ($dom->find("channel item") as $item){
			$r=array();
			$itemNames=BeeRssItem::getEditArray();
			foreach ($itemNames as $itemName){
				$r[$itemName]=$item->find($itemName,0)->innertext;				
			}
			
			$items[]=$r;	
			
		}
		$rss["items"]=$items;		
		$dom->clear();
   		unset($dom);
   		
   		return $rss;
		
		
		
		
		
		
	}
	
	
}
?>